
import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import 'element-ui/lib/theme-chalk/index.css';
import Home from '@/views/Home.vue'
import Main from '@/views/Main.vue'
import CoursesList from '@/views/courses/CoursesList.vue'
import CourseEdit from '@/views/courses/CourseEdit.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'Main',
    component: Main,
    children: [
      {
        path: '/',
        name: 'Home',
        component: Home
      },
      {
        path: '/course/list',
        name: 'CoursesList',
        component: CoursesList
      }, {
        ///course/edit
        path: '/course/edit/:id',
        name: 'CourseEdit',
        component: CourseEdit,
        props: true
      },

      {
        path: '/course/create',
        name: 'CourseCreate',
        component: CourseEdit
      }
    ]
  },

]

const router = new VueRouter({
  routes
})

export default router
